<template>
  <div id="huishangdiv">
    <div v-if="listLoading" style="margin:20px;">正在加载...</div>
    <div v-else>
      <div v-if="mydata && mydata.length > 0">
        <el-button  @click="pinggushow()" style="right:60px;position:fixed;z-index:999" type="success">查看质量评估</el-button>

          <div style="padding:10px 0;">共 <b>{{mydata.length}}</b> 条</div>
        <el-card v-for="(item, index) in mydata" :key="index" keys class="" style="margin:0 0 20px 0">
          <div slot="header" class="clearfix">
            <span><b>通报时间：</b><font style="color:#00f">{{item.Tongbaoshijian}}</font></span>&nbsp;&nbsp;&nbsp;&nbsp;
            <span><b>通报方式：</b><font style="color:#00f">{{item.tongbaofangshi}}</font></span>&nbsp;&nbsp;&nbsp;&nbsp;
            <span><b>通报范围：</b><font style="color:#00f">{{item.tongbaofanwei}}</font></span>
          </div>
            <div class="text item" style="line-height:180%;font-weight:bolder">
              通报稿：
            </div>
            <div class="text item" style="line-height:180%">

              <b>
                <span v-if="item.fileList&&item.fileList.length>0">
                  <div v-for="(item,index) in item.fileList" :key="index">
                    <a href="javascript:void(0)" @click="download(item.id)">{{item.fileName}}.{{item.fileType}}</a>
                    <template v-if="item.fileType==='pdf'"><i style="cursor: pointer;" class="el-icon-search" @click="showfile(item.id)" /></template>
                    <br>
                  </div>
                </span>
                <span v-else>无</span>
              </b>
              <hr style="height:1px;border:0;margin:20px 0;background:#EBEEF5;overflow:hidden">
            </div>
          <div class="text item" style="line-height:180%;font-weight:bolder">
            备注：
          </div>
          <div class="text item" style="line-height:180%">
            {{item.remark}}
          </div>
        </el-card>
      </div>
      <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    timestamp: '',
    leaders: []
  },
  data () {
    return {
      listLoading: false,
      mydata: null,
      banziBaogao: '全部',
      beipipingren: '全部',
      filterList: [],
      sumWenti: 0
    }
  },
  watch: {
    timestamp (val) {
      this.loaddata()
    },
    '$store.state.link_hz' (val) {
      this.activeNameHuishang = this.$store.state.link_hz
    }
    // $refs.tree2.getCurrentNode()
  },
  methods: {
    pinggushow () {
      var params1 = {Link1: 'Pingjia'}
      this.$store.commit('tablink1', params1)
    },
    showfile (id) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.shenghuohuiAPI + 'api/newFileInfo/download?download=false&id=' + id + '&t=' + new Date())
    },
    download (id) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.shenghuohuiAPI + 'api/newFileInfo/download?download=true&id=' + id + '&t=' + new Date())
    },
    loaddata () {
      this.listLoading = true
      let para = {
        shenghuohuiunitId: this.$route.params.id,
        pageNum: 1,
        pageSize: 2000
      }
      this.$http
        .post(this.$http.defaults.shenghuohuiAPI + `api/newHhTongbao/queryByPage`, para)
        .then(response => {
          this.listLoading = false
          if (response.data.success === true) {
            console.log('获取成功')
            this.mydata = response.data.result.records
          } else {
            console.log('获取数据失败:' + response.data.message)
            this.$message({
              message: '获取数据失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
          this.listLoading = false
        })
    }
  }
}
</script>
<style scoped>
.el-form-item{
  margin:0;
}
</style>
<style>
#huishangdiv .el-form-item__label{
  font-size:16px;
}
.chuxi{
  color:green;
}
.nochuxi{
  color:red;
}
#huiyiyicheng .el-form-item__content{
  font-size:16px;
}
</style>
